package org.hzero.business.report.dto;

import org.springframework.util.Assert;

/**
 * 用来规范报表字段顺序
 *
 * @author tianhao.luo@hand-china.com
 */
public class KnifeReportColumnOrder implements Comparable<KnifeReportColumnOrder>{
    /**
     * dto 属性
     */
    private final String fieldName;
    /**
     * 位于报表的位置
     */
    private final Integer order;

    public KnifeReportColumnOrder(String fieldName, Integer order) {
        Assert.notNull(fieldName,"dto属性不能为空");
        if (order == null){
            order = Integer.MAX_VALUE;
        }
        this.fieldName = fieldName;
        this.order = order;
    }

    @Override
    public int compareTo(KnifeReportColumnOrder o) {
        return this.getOrder().compareTo(o.getOrder());
    }

    public String getFieldName() {
        return fieldName;
    }

    public Integer getOrder() {
        return order;
    }
}
